<%@ page pageEncoding="utf-8"%>
<%request.setCharacterEncoding("utf-8");%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@ include file="/include/filepath.jsp"%>
<%@ include file="/include/taglibs.jsp" %>
<%@ include file="/include/pageexpires.jsp" %>
<%@include file="/include/currentuserinfo.jsp"%>
<html>
  <head>
    <title>群组设置</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <link type="text/css" rel="stylesheet" href="<%=ctxpath%>/themes/newstyle/styles/mac/macmenu.css" id="menuStyleSheet">
  </head>
  <script language="javascript">
//
function closeGroup(){
window.opener.document.location.reload();
window.close();
}
function dosave(){
  if(document.chatGroupForm.groupname.value == ''){
  alert('群组名称不能为空！');
  document.chatGroupForm.groupname.focus();
  }else if(document.chatGroupForm.groupname.value.length >= 6){
  alert('群组名称不能超过6个汉字');
  document.chatGroupForm.groupname.focus();
  }else if(document.chatGroupForm.groupdesc.value == ''){
  alert('群组描述不能为空！');
  document.chatGroupForm.groupdesc.focus();
  }else if(document.chatGroupForm.groupdesc.value.length >= 100){
  alert('群组描述不能超过100个汉字！');
  document.chatGroupForm.groupdesc.focus();
  }else if(document.chatGroupForm.groupmember.value == ''){
  alert('群组人员不能为空');
  }else{
  document.chatGroupForm.submit();
  }
}
function restchat(){
document.chatGroupForm.groupname.value = ''
document.chatGroupForm.groupdesc.value = ''
}
function selectmutiuser(id,name,userid) {
    var src = "<%=ctxpath%>/orgmodel/selectmutiuser.jsp?idname=" + id + "&disname=" + name +"&userid="+userid;
    window.open(src, "_blank", "height=500, width=300, top=0, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
}
//onbeforeunload="window.opener.document.location.reload()"
  </script>
  <body scroll="no" id="body" >
    <table id="display" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
      <tr>
        <td valign="top">
          <div id="layer1" style="width:100%; height:100%; z-index:50; overflow: auto;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
              <tr>
                <td valign="top" align="center">
                  <table cellspacing="0" cellpadding="0" class="labeltable_middle">
                    <tr>
                      <td class="labeltd_middle">
                        
                        <%
                        //onUnload="opener.location.reload()"
                        com.ecomm.chat.pojo.ChatGroup chatGroup =(com.ecomm.chat.pojo.ChatGroup)request.getAttribute("chatGroupobject");
                        String useridchat = "";
                        if(chatGroup != null){
                          useridchat = chatGroup.getCerateuserid();
                          
                        }else{
                          useridchat = userid;
                        }
                        %>
                        <html:form  action="/chat/group" method="post" >
                          <input type="hidden" name="method" value="save"/>
                          <html:hidden property="id" value="<%=chatGroup != null ? chatGroup.getId():""%>"/>
                          <html:hidden property="cerateuserid" value="<%=useridchat%>"/>
                          <html:hidden property="groupmember" value="<%=chatGroup != null ? chatGroup.getGroupmember():""%>" />
                          <table  class="labeltable_middle_table">
                            <tr>
                              <td align="center"  colspan="2" class="labeltable_middle_td">新建群组</td>
                            </tr>
                            <tr>
                              <td align="center" class="labeltable_middle_td_01">
                                群组名称：
                                
                              </td>
                              <td >
                                <html:text property="groupname" styleClass="input" value="<%=chatGroup!= null ? chatGroup.getGroupname():""%>"  style="width:80%" /><span class="interim"><font color="red"> *</font></span>不能超过6个汉字
                              </td>
                            </tr>
                            <tr >
                              <td align="center" class="labeltable_middle_td_01">
                                群组描述：
                                
                              </td>
                              <td >
                                <html:textarea  property="groupdesc"  value="<%=chatGroup != null ? chatGroup.getGroupdesc():""%>" rows="6" cols="30"  />
                                <br/> <strong><font color="#FF0000">注：</font></strong>不能超过100个汉字
                                
                              </td>
                            </tr>
                            <tr>
                              <td  align="center" class="labeltable_middle_td_01">
                                群内人员：
                                
                              </td>
                              <td >
                                <input type="text" name="groupmembername" value="<%=chatGroup != null ? com.ecomm.util.CommonMethod.getUsernamesByUserids(chatGroup.getGroupmember()):""%>"  style="width:80%"  readonly /><span class="interim"><font color="red"> *</font></span>
                              </td>
                            </tr>
                            <tr >
                              <td colspan="2" class="labeltable_middle_td">
                                <input type="button" onclick="dosave()" name="save" value="修改或保存">
                                <input type="button" onclick="restchat()" value="重置"/>
                                <input type="button" value="关闭"  onclick="closeGroup()"/>
                                <input type="button"  onclick="selectmutiuser('groupmember','groupmembername','<%=chatGroup != null ? chatGroup.getGroupmember():""%>')" name="chooice" value="选择人员" >
                              </td>
                            </tr>
                          </table>
                        </html:form>
                        
                      </td>
                    </tr>
                  </table>   
                  <table border="0" cellpadding="0" cellspacing="0" class="labeltable_bottom">
                    <tr>
                      <td class="left">&nbsp;</td>
                      <td class="center">&nbsp;</td>
                      <td class="right">&nbsp;</td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>





